/*
 *    Copyright (c) 2018-2025, bfcloud All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: bfcloud
 */

//事件考核 页面接口
import request from '@/router/axios'

// 获取统计名称
export function getTjmcList(params) {
  return request({
    url:'/appr-event/pfhzhzzq/getLeaderHzzq',//二级领导，获取周期列表
    method: 'get',
    params:params
  })
}


// 新增分数提取数据
export function addFstq(obj) {
  return request({
    url: '/appr-event/pfhzfstq',
    method: 'post',
    data: obj
  })
}


//同步数据
export function synchronousData(fstqId,menuType) {
  let url = '' ;
  switch (menuType) {
    case 'ht' :
      url = `/appr-event/pfhzfstqhetong/syncDataLeaders/${fstqId}` ; //重点工作
      break ;
    // case 'pf' :
    //   url =  `/appr-event/pfhzfstqzdrw/syncData/${fstqId}` ; //评分
    //   break ;
    case 'rckh' :
      url = `/appr-event/pfhzfstqrckh/synchronizeLeaders/${fstqId}` ; //日常考核/pfhzfstqrckh/synchronize/{fstqId}
      break ;
    case 'zdrw' :
      url =  `/appr-event/pfhzfstqzdrw/syncLeaderData/${fstqId}` ; //重点工作任务
      break ;
    case 'gzrws' :
      url = `/appr-event/pfhzfstqgzrws/syncLeaderData/${fstqId}` ; //工作任务书同步数据
      break ;
    default :
      break ;
  }
  return request({
    url: url,
    method: 'get',
  })
}


//  更新分数提取数据
export function updateFstq(data) {
  return request({
    url: '/appr-event/pfhzfstq',
    method: 'put',
    data: data
  })
}

// 通过id查询详情
export function getDetailById(id) {
  return request({
    url: `/appr-event/pfhzfstq/${id}`,
    method: 'get',
  })
}

// 分数提取列表 by lx
export function fractionList(query) {
  return request({
    url: `/appr-event/pfhzfstq/page`,
    method: 'get',
    params: query
  })
}

// 分数提取明细列表 by lx
export function fractionMxList(query) {
  return request({
    url: `/appr-event/pfhzfstqmx/page`,
    method: 'get',
    params: query
  })
}


// 选择通用公式计算分数
export function calAllScoreByIds(query) {
  return request({
    url: `/appr-event/pfhzfstqmx/computeMultiScore`,
    method: 'get',
    params: query
  })
}

//计算某个人的得分
export function calRowScoreById(sftqxmId,gsId) {
  return request({
    url: `/appr-event/pfhzfstqmx/computeScore/${sftqxmId}/${gsId}`,
    method: 'get',
  })
}


//保存分数
export function subAllScore(obj) {
  return request({
    url: '/appr-event/rckhsjyjk',
    method: 'put',
    data: obj
  })
}

//获取岗位列表
export function getGwListById(id) {
  return request({
    url: `/appr-event/pfhzfstqmx/getGwList/${id}`,
    method: 'get',
  })
}

//部门集合
export function getSysDeptDtoList(zid) {
  return request({
    url: `/appr-event/pfhzfstqmx/getDeptList/${zid}`,
    method: 'get'
  })
}

//获取分数个数列表
export function getScoreListById(id) {
  return request({
    url: `/appr-event/pfhzfstqmx/getScoreCountList/${id}`,
    method: 'get',
  })
}


//获取公式列表
export function getFormulaList() {
  return request({
    url: '/admin/sysformula/page?current=1&size=1000&gsMc=&gsType=统计分析算法&jjDeptId=0',
    method: 'get',
  })
}

//生成得分
export function generateScoreById(id) {
  return request({
    url: `/appr-event/pfhzfstqmx/completeCompute/${id}`,
    method: 'get',
  })
}

//导入
export function importPfData(obj,sftqId) {
  return request({
    url: `/appr-event/pfhzfstqmx/importFstqMx`,
    method: 'post',
    data: obj,
    params:{sftqId:sftqId},
  })
}


//导出
export function scoreExportExcel(query) {
  return request({
    url: `/appr-event/pfhzfstqmx/pfhzExportExcel`,
    method: 'post',
    data: query,
    responseType: 'blob'
  })
}


//过滤
export function transState(val,menuType) {
  switch (val) {
    case '0':
      return menuType=='pf'?'未导入':"未同步";
      break;
    case '1':
      return menuType=='pf'?'已导入':"已同步";
      break;
    default:
      break;
  }
}

//过滤 lx
export function transStateLx(val) {
  switch (val) {
    case 'ht':
      return "业绩合同";
      break;
    case 'rckh':
      return "日常考核";
      break;
    case 'pf':
      return "测评";
      break;
    case 'zdrw':
      return "重点任务";
      break;
    case 'gzrws':
      return "工作任务书";
      break;
    default:
      break;
  }
}



















